<template>
    <div>
        <h1>axios1页面</h1>
        <h1>get:{{ getuserdao }}</h1>
        <h1>post:{{ postuserdao }}</h1>
    </div>
</template>

<script>
{/* 2. 导入封装好的axios依赖 */}
import {reqPost,reqGet} from '@/util/request'
export default{
    mounted(){
        reqPost('/zhongbei/postUserByUsername',{
            username:'lisi'
        }).then(resp =>{
            this.postuserdao=resp.data.data
            console.log(resp)
        }).catch(error=>{
            console.error('error data',error)
        });

        reqGet('/zhongbei/userbyid',{
            id:'1'

        }).then(resp =>{
            this.getuserdao=resp.data.data
            console.log(resp)
        }).catch(error=>{
            console.error('error data',error)
        });
    },
    data(){
        return{
            postuserdao:'',
            getuserdao:''
        }
    }
}
</script>
